<template>
  <div class="monitorData">
    <TitleColumn name="监测数据" />
    <div class="content">
      <div class="mask"></div>
      <div class="success tips">
        <h3>正常统计</h3>
        <h4><span>78</span>个</h4>
      </div>
      <div class="error tips">
        <h3>超警戒统计</h3>
        <h4><span>32</span>个</h4>
      </div>
      <div class="chartRef" ref="chartRef"></div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref, onMounted } from "vue";
import TitleColumn from "@/components/TitleColumn";
import { CountTo } from "@gui-pkg/components";
import { vue3ScrollSeamless } from "vue3-scroll-seamless";
import Percentage from "./Percentage.vue";
import * as echarts from "echarts";
import "echarts-gl";
import { getPie3D } from "./3dPie.js";
import { get3DOption } from "./3DpieOption";
import { useECharts } from "@gui-pkg/hooks";

const chartRef = ref(null);
const { setOptions } = useECharts(chartRef);
const state = reactive({
  statisticsData: [1, 2, 3, 4, 5],
});
onMounted(() => {
  let echartData = [
    {
      name: "超警戒统计",
      value: 32,
    },
    {
      name: "正常统计",
      value: 78,
    },
  ];
  let colorList = ["#ee8334", "#56baf7"];
  let option = get3DOption(echartData, colorList);
  console.log(option, "option");
  setOptions(option, true);
});
</script>

<style lang="less" rel="stylesheet/less" scoped>
.monitorData {
  width: 100%;
  .content {
    width: 100%;
    height: calc(100% - 24px);
    background: #02123433;
    backdrop-filter: blur(10px);
    position: relative;
    .mask {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: 10;
      background: url(./images/bg.png) no-repeat;
      background-size: 100% 100%;
    }
    .tips {
      padding-top: 10px;
      h3 {
        font-family: Source Han Sans CN;
        font-size: 14px;
        font-weight: 400;
        color: #d7eeff;
        text-align: center;
      }
      h4 {
        font-family: DIN Alternate;
        font-size: 24px;
        font-weight: 700;
        color: #ffffff;
        text-align: center;
      }
    }
    .success {
      width: 186px;
      height: 82px;
      background: url(./images/success_bg.png) no-repeat;
      background-size: 100% 100%;
      position: absolute;
      right: 30px;
      top: 60px;
      z-index: 20;
      h3 {
        transform: translateX(30px);
      }
      h4 {
        transform: translateX(30px);
      }
    }
    .error {
      width: 186px;
      height: 82px;
      background: url(./images/error_bg.png) no-repeat;
      background-size: 100% 100%;
      position: absolute;
      left: 30px;
      top: 60px;
      z-index: 20;
      h3 {
        transform: translateX(-30px);
      }
      h4 {
        transform: translateX(-30px);
      }
    }
    .chartRef {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: 20;
    }
  }
}
</style>
